<template>
  <div class="kh-card-list">
    <div class="kh-card kh-card-adapt" v-for="card in cardList">
      <div class="kh-card-img">
        <a href="javascript:;">
          <img :src="card.img" alt="default">
        </a>
      </div>
      <div class="kh-card-title">
        <a href="javascript:;">{{card.title}}</a>
        <p>{{card.tag}}</p>
      </div>
      <div class="kh-card-eye">
        <p>{{card.eyes}}</p>
      </div>
      <div class="kh-card-sign">
        <p>{{card.author}}</p>
        <p></p>
      </div>
    </div>

    <div class="kh-view-tip"></div>
  </div>
</template>

<script>
  export default {
    name: "article-list",
    data() {
      return {
        cardList: [
          {
            id: 0,
            title: '测试标题测试标题测试标题测试标题',
            tag: 'javascript',
            author: '总有刁民在撸朕的管',
            time: '2018 10.25',
            eyes: '121',
            img: '../../../static/blog/test.jpg'
          },
          {
            id: 0,
            title: '测试标题测试标题测试标题测试标题',
            tag: 'javascript',
            author: '总有刁民在撸朕的管',
            time: '2018 10.25',
            eyes: '121',
            img: '../../../static/blog/test.jpg'
          },
          {
            id: 0,
            title: '测试标题测试标题测试标题测试标题',
            tag: 'javascript',
            author: '总有刁民在撸朕的管',
            time: '2018 10.25',
            eyes: '121',
            img: '../../../static/blog/test.jpg'
          },
          {
            id: 0,
            title: '测试标题测试标题测试标题测试标题',
            tag: 'javascript',
            author: '总有刁民在撸朕的管',
            time: '2018 10.25',
            eyes: '121',
            img: '../../../static/blog/test.jpg'
          }
        ]
      }
    }
  }
</script>

<style lang="scss" scoped>
  .kh-card-list {
    margin-top: 100px;
    display: flex;
    flex-wrap: wrap;
  }

  .kh-card {
    width: 31%;
    margin-right: 3%;
    margin-bottom: 80px;
    font-weight: 200;
    box-shadow: 0 0 10px #eee;

  &
  :nth-child(3n) {
    margin-right: 0;
  }

  .kh-card-img {
    width: 100%;
    height: calc(100% - 220px);
    background-color: red;

  a {
    display: block;
    height: 100%;
    width: 100%;
    overflow: hidden;

  &
  :hover {

  img {
    transform: scale(1.06);
  }

  }

  img {
    width: 100%;
    vertical-align: top;
    transition: all .5s;
  }

  }
  }

  .kh-card-title {
    margin: 30px 0 20px 0;
    padding: 0 20px;
    font-size: 18px;
    color: #999;

  a {
    color: #000;
    display: block;
    text-overflow: ellipsis;
    white-space: nowrap;
    overflow: hidden;
    font-size: 22px;
    font-weight: 400;
    margin: 0 0 8px 0;
  }

  }

  .kh-card-eye {
    padding: 0 20px;
    font-size: 16px;
    color: #999;

  p {
    position: relative;
    padding-left: 32px;

  &
  :after {
    content: '';
    position: absolute;
    top: 2px;
    left: 0;
    width: 24px;
    height: 16px;
    background-image: url("../../../static/blog/eye.png");
    background-repeat: no-repeat;
    background-size: contain;
    background-position: center;
  }

  }
  }

  .kh-card-sign {
    color: #666;
    display: flex;
    justify-content: space-between;
    margin-top: 20px;
    padding: 20px 20px 30px;
    border-top: 2px solid #e6e6e6;

  p {

  &
  :first-child {
    color: #333;
    max-width: 160px;
    text-overflow: ellipsis;
    white-space: nowrap;
    overflow: hidden;
  }

  }
  }
  }

  @media (max-width: 1350px) {
    .kh-card-adapt {
      width: 46%;
      margin-right: 8%;

  &:nth-child(2n) {
     margin-right: 0;
   }

  &:nth-child(2n - 1) {
     margin-right: 8%;
   }
  }

  }

  .kh-view-tip {
    height: 2px;
    width: 100%;
    margin-bottom: 80px;
    background-color: red;
  }
</style>
